package zkk.com.mengqu.activity;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import zkk.com.mengqu.R;
import zkk.com.mengqu.adapter.PrivateFoodCommentAdapter;
import zkk.com.mengqu.util.NoScrollListView;

/**
 * Created by Administrator on 2017/4/12.
 * 私人菜谱
 */
public class PrivateFoodActivity extends Activity implements View.OnClickListener{
    private Context context;
    private ImageView back,share,collect;//返回,分享，收藏
    private TextView buy;//购买
    private NoScrollListView listView;
    private PrivateFoodCommentAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_private_food);
        context = getApplicationContext();
        initView();
    }

    public void initView(){
        back = (ImageView)findViewById(R.id.iv_back);
        share = (ImageView)findViewById(R.id.iv_share);
        collect = (ImageView)findViewById(R.id.iv_collect);
        buy = (TextView)findViewById(R.id.tx_buy);

        listView = (NoScrollListView)findViewById(R.id.listview);
        adapter = new PrivateFoodCommentAdapter(context);
        listView.setAdapter(adapter);

        back.setOnClickListener(this);
        share.setOnClickListener(this);
        collect.setOnClickListener(this);
        buy.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.iv_back:
                finish();
                break;
            case R.id.iv_share:
                Toast.makeText(context , "分享", Toast.LENGTH_LONG).show();
                break;
            case R.id.iv_collect:
                Toast.makeText(context , "收藏", Toast.LENGTH_LONG).show();
                break;
            case R.id.tx_buy:
                Toast.makeText(context , "购买菜谱", Toast.LENGTH_LONG).show();
                break;
            default:
                break;
        }
    }
}
